
<script type="text/javascript" src="<?php echo URL_JS; ?>ckeditor/ckeditor.js"></script>

<?php

// Si le fichier de qui definie les constantes n'a pas encore ete appele on le charge
if (!defined('CONFIGURATION_FILE_LOADED'))
    include( 'includes/configuration_include.php');

include( PATH_MODELS . 'update_about_model.php');
include( PATH_VIEWS . 'update_about_view.php');

$bdd = model_db_connexion();
// Si l'utilisateur est deja logue
if (!empty($_SESSION['id_user'])) {


    echo'<span class="template_title">Gestion de "qui sommes nous ?"</span>
               <span class="template_box_admin">';

    if (isset($_POST['new_about_message'])) {



        //On propose de changer le message d'acceuil
        $new_about_message = $_POST["new_about_message"];
        $req = selectMessage($bdd);
        UpdateMessage($bdd, $new_about_message);

        viewCreated($new_about_message);

        printNewMessage();
    } else {
        //On affiche le message d'acceuil actuel
        $req = selectMessage($bdd);

        while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) {
            $about_message = $donnees['about_message'];

            printMessage($about_message);
        }
        printNewMessage();
    }
    echo '</span>';
} else {
    echo '<span class="template_span">' . LANG_NO_CONNECT . '</span>';
}

echo'<script type="text/javascript">
       CKEDITOR.replace("visu", 
    {
    height:"100", width:"500"
    });

    </script>';
?>
